<?php

require_once dirname(__FILE__).'/../bootstrap/unit.php';
require_once (dirname(__FILE__).'/../../apps/frontend/lib/Jobeet.class.php');

$t = new lime_test(9, new lime_output_color("Red"));
 
$t->comment('Jobeet::slugify()');
$t->is(Jobeet::slugify('Sensio'), 'sensio', 'converts all characters to lower case');
$t->is(Jobeet::slugify('sensio labs'), 'sensio-labs', 'replaces a white space by a -');
$t->is(Jobeet::slugify('sensio   labs'), 'sensio-labs', 'replaces several spaces by a single -');
$t->is(Jobeet::slugify('  sensio'), 'sensio', 'removes - at the beginning of a string');
$t->is(Jobeet::slugify('sensio  '), 'sensio', 'removes - at the end of a string');
$t->is(Jobeet::slugify('paris,france'), 'paris-france', 'replaces non-ASCII characters by a -');
$t->is(Jobeet::slugify(''), 'N/A', 'converts the empty string to N/A');
$t->is(Jobeet::slugify(' - '), 'N/A', 'converts a string that only contains non-ASCII characters to N/A');
if (function_exists('iconv')){
  $t->is(Jobeet::slugify('Développeur Web'), 'developpeur-web', 'removes accents');
}else{
  $t->skip('::slugify() removes accents - iconv not installed');
}
